#include <iostream>
#include "CRF.h"
#include "MaxLattice.h";
using namespace std;

int main() {
	InstanceList* list = new InstanceList();
	list->addFileToken("D:/cspace/SCRF/ff/chk.sml");
	Instance* temp;
	value_t* orac;
	value_t* pred;
	printf("\n");
	cout << list->size() << endl;
	cout << list->getFeatureAlphabet()->size() << endl;
	cout << list->getLabelAlphabet()->size() << endl;
	CRF* model = new CRF(list);
	model->train();
	for (int i = 0; i < list->size(); ++i) {
		printf("%d\n", i);
		temp = list->get(i);
		orac = temp->getLabels();
		for (int j = 0; j < temp->size(); ++j) {
			printf("%d ", orac->at(j));
		}
		printf("\n");
		MaxLattice* lattice = new MaxLattice(model, temp->getFeatureVectors(), NULL);
		pred = lattice->best();
		for (int j = 0; j < pred->size(); ++j) {
			printf("%d ", pred->at(j));
		}
		printf("\n");
	}
}
